package com.gzw.dms.mode;



import com.gzw.dms.bean.GoodsResourceInfo;
import com.gzw.dms.utils.HttpUtils;
import com.gzw.dms.utils.JsonUtil;
import com.gzw.dms.utils.UrlUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2016/1/22.
 */
public class GoodsSourceModelImpl implements IGoodsSourceModel{
    @Override
    public String selectGoodsResource() {
        return HttpUtils.doPost(UrlUtils.getInstance().getServiceUrl("selectGoodsResource"), null);
    }

    @Override
    public String selectGoodsResourceUserId(int userId) {
        Map<String ,Object> map=new HashMap<>();
        map.put("userId",String.valueOf(userId));
        String json= JsonUtil.toJson(map);
        return HttpUtils.doPost(UrlUtils.getInstance().getServiceUrl("selectGoodsResourceUserId"), "json=" + json);
    }

    @Override
    public String addGoodsResource(GoodsResourceInfo goodsResourceInfo) {
        String json= JsonUtil.toJson(goodsResourceInfo);
        return HttpUtils.doPost(UrlUtils.getInstance().getServiceUrl("addGoodsResource"), "json=" + json);
    }

    @Override
    public String deleteGoodsResource(int id) {
        Map<String ,Object> map=new HashMap<>();
        map.put("id",String.valueOf(id));
        String json= JsonUtil.toJson(map);
        return HttpUtils.doPost(UrlUtils.getInstance().getServiceUrl("deleteGoodsResource"), "json=" + json);
    }


}
